#ifndef INCLUDES_H
#define INCLUDES_H

#define ID_RAND		911
#define ID_TXACK	912
#define ID_RXFRAME	913
#define ID_DELAY	914

#define BUFSIZE		512
#define BUFFER(x,y) *(pinfo->pBuffer + (y) * pinfo->cxBuffer + (x))
#define FRAMESIZE	1005
#define DATASIZE	1000
#define TYPEINDEX	1
#define STARTOFDATA	2
#define EOTCHECK	1002
#define CRC1		1003
#define CRC2		1004
#define MAX         3
#define ACKTIME     500
#define FRAMETIME   1500
#define RANDOMTIME  (rand() % 47) + 100
#define DELAY       150



#include <Windows.h>
#include <stdio.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM);

typedef struct tagTTYINFO
{
	HWND			hwnd, dlghwnd;
	HANDLE			hPort, ENQ, ACK, frameBuilt, FrameToSend, wait, delay;
	HMENU			hMenu;
    TCHAR			*pBuffer;
	FILE			*inputFile;
	char			frameTypeToWrite, frameTypeExpected, frameTypeSent;
	unsigned char	txFrame[FRAMESIZE], rxFrame[FRAMESIZE], printData[DATASIZE];
	bool			bReading, transmitting, receiving, endoftransmission, receivedLastFrame;
	DWORD			rThread, xThread, dThread;
	HANDLE			readThread, protocolThread, displayThread;
	LPCTSTR			portName;
	COMMCONFIG		cc;
	COMMPROP		cp;
	COMMTIMEOUTS	cto;
	int				cxChar, cyChar, iVertPos, cxBuffer, cyBuffer,
				      xCaret, yCaret, NUMLINES, cxClient, cyClient;
	int				num_PacketsTransfered, num_PacketsReceived, num_AcksSent, num_AcksReceived, num_EnqsSent, num_EnqsReceived, num_PER,
					num_CorruptPacketsReceived, num_CorruptPacketsSent, num_DuplicatePacketsReceived, num_DuplicatePacketsSent;

} TTYINFO, *PTTYINFO ;

#endif 
